package com.yyfax.pay.vo.depository;

import javax.validation.constraints.Min;

import org.hibernate.validator.constraints.NotBlank;

import com.yyfax.framework.model.BasePO;
import com.yyfax.framework.yyfax.enums.TerminalEnum;
import com.yyfax.pay.common.exception.PayExceptionCode;

/**
 * 富友基础请求参数
 * 
 * @author buyi
 * @date 2017-08-25 09:46:13
 * @since v2.0.0
 */
@SuppressWarnings("serial")
public abstract class ChargeBaseReq extends BasePO {
	/** 商户订单号 */
	@NotBlank(message = "orderId不能为空")
	private String orderId;
	/** 商户订单时间 */
	@NotBlank(message = "orderTime不能为空")
	private String orderTime;
	/** 商户用户id */
	@NotBlank(message = "userId不能为空")
	private String userId;
	/** 登录ID */
	@NotBlank(message = "loginId不能为空")
	private String loginId;
	/** 终端类型 */
	@NotBlank(message = "terminal不能为空")
	private String terminal;

	@Min(value = 1, message = "amount必须为数字，且不能小于1")
	private long amount;

	/** 异步回调地址 */
	private String notifyUrl;

	private String remark;

	public String getOrderId() {
		return orderId;
	}

	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}

	public String getOrderTime() {
		return orderTime;
	}

	public void setOrderTime(String orderTime) {
		this.orderTime = orderTime;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getLoginId() {
		return loginId;
	}

	public void setLoginId(String loginId) {
		this.loginId = loginId;
	}

	public String getTerminal() {
		return terminal;
	}

	public void setTerminal(String terminal) {
		this.terminal = terminal;
	}

	public long getAmount() {
		return amount;
	}

	public void setAmount(long amount) {
		this.amount = amount;
	}

	public String getNotifyUrl() {
		return notifyUrl;
	}

	public void setNotifyUrl(String notifyUrl) {
		this.notifyUrl = notifyUrl;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * 校验参数
	 * 
	 * @author buyi
	 * @date 2018-06-20 10:59:13
	 * @since v2.2.2
	 */
	public void validParams() {
		// 判断枚举类型
		for (TerminalEnum terminalEnum : TerminalEnum.values()) {
			if (terminalEnum.getValue().equals(terminal)) {
				return;
			}
		}

		throw PayExceptionCode.ERROR_ILL_PARAMETER.expMsg("terminal非法");
	}
}
